package com.mass.core.sys.metadata.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.mass.core.sys.metadata.model.SysMetadata;
import com.mass.core.sys.metadata.services.SysMetadataServices;
import com.mass.core.utils.AjaxResponse;

@RestController
@RequestMapping("/sysMetadata")
public class SysMetadataController {

	@Autowired
	private SysMetadataServices sysMetadataServices;
	
	/**
	 * 
	* @Title: findSysMetadataPage
	* @Description: 分页条件查询
	* @param sysMetadata
	* @param pageIndex
	* @param pageSize
	* @return
	* AjaxResponse 返回类型   
	* @throws
	 */
	@RequestMapping("/findSysMetadataPage")
	public AjaxResponse findSysMetadataPage(SysMetadata sysMetadata,Integer page,Integer limit){
		return sysMetadataServices.findSysMetadataPage(sysMetadata, page, limit);
	}
	
	/**
	 * 
	* @Title: insert
	* @Description: 添加  
	* @param sysMetadata
	* @return AjaxResponse 返回类型   
	* @throws
	 */
	@RequestMapping("/insert")
	public AjaxResponse insert(SysMetadata sysMetadata){
		sysMetadata.setMetadataName("按钮名称");
		sysMetadata.setMetadataCode("按钮编码");
		sysMetadata.setMetadataIcon("按钮图标");
		sysMetadata.setMetadataTypes(1);
		sysMetadata.setMetadataPath("按钮位置");
		return sysMetadataServices.insert(sysMetadata);
	}
	
	/**
	 * 
	* @Title: update
	* @Description: 修改  
	* @param sysMetadata
	* @return  AjaxResponse 返回类型   
	* @throws
	 */
	@RequestMapping("/update")
	public AjaxResponse update(SysMetadata sysMetadata){
		return sysMetadataServices.update(sysMetadata);
	}
	
	/**
	 * 
	* @Title: oneButtonAdded
	* @Description: 一键新增按钮
	* @param menuName   模块名称
	* @param menuId   模块Id
	* @return AjaxResponse 返回类型   
	* @throws
	 */
	@RequestMapping("/oneButtonAdded")
	public AjaxResponse oneButtonAdded(String menuName,Long menuId){
		return sysMetadataServices.oneButtonAdded(menuName,menuId);
	}
}
